#!/usr/bin perl

use fig;

sub callback {
    @coins = ();
    my ($topic,$message) = @_;
    while($message =~ /(60[0-9]{4})/g){
        push(@conins,$1);
    }
    $result = join(",",@conins);
    my %config = ("broker" => "127.0.0.1:1883",
    "username"=>"admin",
    "password"=>"123456",
    "topic"=>"set/result",
    "message"=>$result);
     mqtt_sender(%config)
}

my %config = ("broker" => "127.0.0.1:1883",
"username"=>"admin",
"password"=>"123456",
"topic"=>"get/code",
"callback"=> \&callback);
mqtt_client(%config);